<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

use  Illuminate\Support\Facades\Route;

    Route::get('search','Api\VideoController@search');
    //后台影视列表
    Route::get('admin_videolist',function(Request $request){
        $q = $request->get('q');
        return \App\Models\Video::where('name','like',"%$q%")->paginate(null,['id','name as  text']);
    });
    //后台会员列表
    Route::get('admin_user_list',function (Request $request){
        $q = $request->get('q');
        return \App\Models\User::where('nickname','like',"%$q%")->paginate(null,['id','nickname as  text']);
    });




//API 接口
Route::post('login','Api\UserController@login');

//轮播图
Route::get('banner','Api\TaskController@banner');
//影视导航
Route::get('video_type','Api\VideoController@video_type');
//影视列表
Route::get('video_list','Api\VideoController@video_list');

//需要token部分
Route::group(['middleware' => ['auth.api']], function () {
    //获取影视详情
    Route::get('video','Api\VideoController@video');
    //影视解析
    Route::get('video_decode','Api\VideoController@video_decode');
});